package com.combetter.changxing.collections;

import android.support.annotation.LayoutRes;

/**
 * Created by Mark.fan on 2018/5/15.
 */

public final class ItemView {
    private int bindingVariable;

    @LayoutRes
    private int layoutRes;

    public static ItemView of(int bindingVariable, int layoutRes) {
        return new ItemView()
                .setBindingVariable(bindingVariable)
                .setLayoutRes(layoutRes);

    }

    public int bindingVariable() {
        return bindingVariable;
    }

    public ItemView setBindingVariable(int bindingVariable) {
        this.bindingVariable = bindingVariable;
        return this;
    }

    @LayoutRes
    public int layoutRes() {
        return layoutRes;
    }

    public ItemView setLayoutRes(int layoutRes) {
        this.layoutRes = layoutRes;
        return this;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }

        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        ItemView itemView = (ItemView) o;
        if (bindingVariable != itemView.bindingVariable) {
            return false;
        }

        return layoutRes == itemView.layoutRes;
    }

    @Override
    public int hashCode() {
        int result = bindingVariable;
        result = result * 31 + layoutRes;
        return result;
    }
}
